using Microsoft.Phone.Controls;
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
namespace MicroMsg.UI.UserContrl
{
	public class PhotoListLineView : UserControl
	{
		public delegate void ListItemClick(object sender, object object_0);
		private PhotoListLine mItemObj;
		public static DependencyProperty ListItemProperty = DependencyProperty.Register("ItemObject", typeof(PhotoListLine), typeof(PhotoListLineView), new PropertyMetadata(null, new PropertyChangedCallback(PhotoListLineView.OnItemPropertyChanged)));
		internal Button btnLayoutRoot;
		internal Border border;
		internal ChooserImage img0;
		internal ChooserImage img1;
		internal ChooserImage img2;
		internal ChooserImage img3;
		private bool _contentLoaded;
		public event PhotoListLineView.ListItemClick ItemClick;
		public PhotoListLine ItemObject
		{
			get
			{
				return (PhotoListLine)base.GetValue(PhotoListLineView.ListItemProperty);
			}
			set
			{
				base.SetValue(PhotoListLineView.ListItemProperty, value);
			}
		}
		public PhotoListLineView()
		{
			this.InitializeComponent();
			base.SetValue(TiltEffect.IsTiltEnabledProperty, true);
		}
		private static void OnItemPropertyChanged(DependencyObject dependencyObject_0, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs_0)
		{
			if (dependencyPropertyChangedEventArgs_0.get_Property() == PhotoListLineView.ListItemProperty)
			{
				(dependencyObject_0 as PhotoListLineView).OnListItemPropertyChanged(dependencyPropertyChangedEventArgs_0);
			}
		}
		private void OnListItemPropertyChanged(DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs_0)
		{
			try
			{
				this.RefreshItem(dependencyPropertyChangedEventArgs_0.get_NewValue() as PhotoListLine);
			}
			catch (Exception ex)
			{
				ex.ToString();
			}
		}
		public void RefreshItem(PhotoListLine item)
		{
			if (item != null && item.pictures != null)
			{
				this.mItemObj = item;
				this.img0.SetPicture(item.pictures[0]);
				this.img1.SetPicture(item.pictures[1]);
				this.img2.SetPicture(item.pictures[2]);
				this.img3.SetPicture(item.pictures[3]);
				return;
			}
		}
		private void btnLayoutRoot_Click(object sender, RoutedEventArgs e)
		{
			if (this.ItemClick != null)
			{
				this.ItemClick(this, this.ItemObject);
			}
		}
		[DebuggerNonUserCode]
		public void InitializeComponent()
		{
			if (this._contentLoaded)
			{
				return;
			}
			this._contentLoaded = true;
			Application.LoadComponent(this, new Uri("/MicroMsg;component/Source/UI/Util/MultiPhotoChooser/PhotoListLineView.xaml", 2));
			this.btnLayoutRoot = (Button)base.FindName("btnLayoutRoot");
			this.border = (Border)base.FindName("border");
			this.img0 = (ChooserImage)base.FindName("img0");
			this.img1 = (ChooserImage)base.FindName("img1");
			this.img2 = (ChooserImage)base.FindName("img2");
			this.img3 = (ChooserImage)base.FindName("img3");
		}
	}
}
